﻿(function ($) {

	function show(modalOptions) {

		var ads = [$('#myCarousel'), $('#myAllsoftCarousel')];
		$('#main-content h3').each(function (i) {
			if (i == 0 || ads.length == 0)
				return;

			ads.pop().insertAfter($(this));
		});


		return;

		var options = $.extend({}, defaultOptions, modalOptions);

		var $after = $(options.headId);

		$(options.contentBlockId + ' ' + options.textElementSelector).each(function () {
			var $this = $(this);
			$this.insertAfter($after);
			
			if ($this[0].tagName.toLowerCase() == options.afterElement && options.adsBlockIds.length > 0) {
				$after = $(options.adsBlockIds.pop()).show();
			} else {
				$after = $this;
			}
		});

		if (options.adsBlockIds.length > 0) {
			$(options.adsBlockIds.pop()).show();
		}
	}
/*
*	$.SmarlyAdsense.show({});
*/

	var defaultOptions = {
		headId: '#part-head',
		contentBlockId: '#main-content',
		textElementSelector: '[id^="text-"]',
		afterElement: 'h3',
		adsBlockIds: ['#adslink3', '#adslink2', '#adsmedia1', '#adslink1'],
	};

	$.extend({
		SmarlyAdsense: {
			show: show
		}
	});
})(jQuery);